<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css" />
    <link rel="stylesheet" type="text/css" href="../../css/swiper.css" />

    <!-- Demo styles -->
    <style>
.scroll-wrap{
  width: 90%;
  margin:0 auto;
  height: 2rem;
  overflow: hidden;
  margin-top:5px;
  /* background:#F7F4F2; */
}

.scroll-content{
  position: relative;
  transition: top 0.5s;
  float: left;
  width: 80%;
  white-space:nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
  font-size: 14px;
}
  li{
    height:2rem;
    line-height: 2rem;
    text-align: left;
    margin-left:1rem;
    color: #888;
  }
    </style>

</head>

<body style="background-color:#f0f0f0">

    <div id="app" class="container" style="padding-top:170px;" v-cloak>
        <div class="scroll-wrap" class="scrolllist">
            <div style="float: left;line-height:2rem;height:2rem"><img src="../../image/gonggao.png"  style="width: 1.4rem;vertical-align: middle;"></div>
            <ul class="scroll-content" :style="{ top }" >
                <li v-for="item in newsList" v-myclick="[item.essay_id, showEssay]">
                  
                  <span class="msg_red">{{item.title}}</span>
                  <span style="margin-left: 60px;">{{gettime(item.date_add)}}</span>
                </li >  
            </ul>
            <div style="float: right;line-height:2rem;height:2rem;color: #888;font-size: 14px;margin-left: 10px;" v-myclick="morehelp">更多</div>

            <div style="clear:both"></div>
        </div>
        <div class="home-icons-box">
            <div class="home-icons">
                <span class="home-icons-single">
                    <img src="../../image/qiandao.png" v-myclick="getsign">
                    <div>签到</div>
                </span>
                <!-- <span class="home-icons-single" v-myclick="kuangji">
                    <img src="../../image/jiaohuan.png">
                    <div>矿机市场</div>
                </span> -->
                <span class="home-icons-single" v-myclick="zhuanpan">
                    <img src="../../image/zhuanpan.png">
                    <div>幸运转盘</div>
                </span>
                <span class="home-icons-single" v-myclick="getguessing">
                    <img src="../../image/jingcai.png">
                    <div>竞猜</div>
                </span>
                <span class="home-icons-single" v-myclick="liaotian">
                    <img src="../../image/zhuanpan.png">
                    <div>聊天室</div>
                </span>
                <span class="home-icons-single" v-myclick="liulanqi">
                    <img src="../../image/liulanqi.png">
                    <div>浏览器</div>
                </span>
                <span class="home-icons-single" v-myclick="cunbi">
                    <img src="../../image/cunqian.png">
                    <div>存币生息</div>
                </span>
            </div>
        </div>
        <div>
            <div class="adtitle">CC生态助力XT交易所换CCB链上币</div>
            <div class="adcontent">
                CCB是CC矿币5:1的浓缩产品，且通过二次挖矿产生，其价值极高，流通量更少，流通性也更好，目前在C网和薄饼交易所已经开启流通，下一步就是跟XT网流通，流通更能提升价值！</br>
XT网换链后，原来在平台的矿币将各自提出，只能购买矿机挖矿产出CCB。</br>
XT网上币费是2万U，换链费经多次协商，需要5000USDT。换链费用社区将以优惠价格让利私募筹集，敬请会员们踊跃认购，成功换链后直接充值到XT网会员账户上，为保护认购者利益，等币价稳定后才开启充值。</br>
每人限购50USDT，获币2000CCB，目前市场价值约100U，上了XT更值钱。
市场价：薄饼交易所 0.05USDT   大C网：0.05USDT
感谢大家对CCB发展的大力支持！下一个暴富的人可能是您哦！
            </div>
            <div class="adaddress">汇款地址（TRC20）：THXE89wLe9p2ks3KMDymgSA5P1Ke7qpXDx<span class="copytext" v-myclick="copy">复制</span></div>
            <div class="adprot">
                <span style="vertical-align: middle;">付款二维码</span>
                <img style="vertical-align: middle;width: 80px;margin-left: 5px;" src="../../image/xtaddress.jpg" />
                <span style="vertical-align: middle;margin-left: 5px;" v-show="!payimage">上传转账截图</span>
                <img style="vertical-align: middle;width: 80px;margin-left: 5px;" v-show="payimage" :src="payimage" />

                <span class="copytext" v-myclick="setPortrait">上传</span>
            </div>
        </div>
</body>
<script src="../../script/vue.js"></script>
<script src="../../script/api.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script src="../../script/components.js"></script>
<script src="../../script/swiper.js"></script>

<script>

    var tags,
        UIScrollPicture,
        MNActionButton,
        clipBoard,
        banners,
        swiper,
        slideindex,
        state,
        timetap,
        newsList,
        explorer,
        vm;

    var wx;
    apiready = function () {
        showProgress();
        UIScrollPicture = api.require('UIScrollPicture');
        MNActionButton = api.require('PIActionButton');
        clipBoard = api.require('clipBoard');
        wx = api.require('wx');
        setBSImg();
        var data = {
            member_id: getPrefs('member_id')
        };
        var callback = function (ret) {
            var home = ret.content;
            banners = home.homeBanner;
            newsList = home.essays;
            explorer = home.explorer;
            fnOpen();
            initApp();
            api.parseTapmode();
        };
        pinet.post(URL.getHomeData, data, callback);
        setRefreshHeaderInfo(refresh);

        api.addEventListener({
            name: 'home'
        }, function () {
            refresh();
        });
    };


    function refresh() {
        var data = {
            member_id: getPrefs('member_id')
        };
        var callback = function (ret) {
            var home = ret.content;
            banners = home.homeBanner;
            if (vm) {
                vm.key++;
            } else {
                initApp();
            }
            fnOpen();
            api.refreshHeaderLoadDone();
        };
        var errback = function () {
            api.refreshHeaderLoadDone();
        };

        pinet.post(URL.getHomeData, data, callback, errback);
    }

    function initApp() {
        vm = new Vue({
            el: "#app",
            data: {
                listOf2col: true,
                url: URL.getHomeData,
                BSImg: Vue.BSImg,
                activeIndex: 1,
                key: 0,
                showtype:true,
                explorer:explorer,
                newsList:newsList,
                payimage:null
            },
            computed: {
                top() {
                return - this.activeIndex * 2 + 'rem';
                }
            },
            mounted:function(){
                setInterval(_ => {
                if(this.activeIndex <= this.newsList.length-2) {
                    this.activeIndex += 1;
                } else {
                    this.activeIndex = 1;
                }
                }, 2000);
				},
            methods: {
                setPortrait: function () {
                    api.actionSheet({
                        cancelTitle: '取消',
                        buttons: ['拍照', '从手机相册选择'],
                        style: {
                            fontNormalColor: '#000',
                            fontPressColor: '#000',
                        }
                    }, function (ret, err) {
                        var index = ret.buttonIndex;
                        switch (index) {
                            case 1:
                                return vm.getPicture('camera');
                            case 2:
                                return vm.getPicture('album');
                            default:
                                break;
                        }
                    });
                },
                getPicture: function (sourceType) {
                    api.getPicture({
                        sourceType: sourceType,
                        targetWidth:600,
                        encodingType:'jpg'
                    }, function (ret) {
                        if (ret) {
                            showProgress();
                      var data = {
                          member_id: getPrefs('member_id')
                      };
                      var file = {
                          file: ret.data
                      };
                      var callback = function () {
                          vm.payimage = ret.data;
                          alert('恭喜您参与成功！');

                      };
                       pinet.postFiles(URL.uploadpayimage, data, file, callback);
                        }
                    });
                },
                copy:function(){
                    clipBoard.set({
                        value: 'THXE89wLe9p2ks3KMDymgSA5P1Ke7qpXDx'
                    }, function (ret) {
                        if (ret) {
                            api.toast({
                                msg: '已复制到剪贴板',
                            });
                        }
                    });
                },
                changeFavor: function (good) {
                    changeFavor(good);
                },
                morehelp(){
                    openWin('../user/help');
                },
                openGoodsDetail: function (goods_id) {
                    openGoodsDetail(goods_id);
                },
                getsign: function () {
                    openWin('../user/sign');
                },
                getguessing: function () {
                    openWin('../home/guessing');
                },
                zhuanpan: function () {
                    // api.toast({
                    //     msg:'暂未开放'
                    // })
                    openWin('../home/zhuanpan');
                },
                kuangji:function(){
                    openWin('../home/machine_market');
                },
                cunbi: function () {
                    // api.toast({
                    //     msg:'暂未开放'
                    // })
                    openWin('../home/ccwallet');
                },
                liulanqi: function () {
                    openWin('browser', { url:this.explorer });
                },
                liaotian:function(){
                    openWin('../win/win_group');

                },
                zanwei: function () {
                    api.toast({
                        msg: '暂未开放'
                    })
                },
                jumpTag: function (tag) {
                    var attributes = {
                        category_id: tag.action.action_params.category_id
                    };
                    onEvent('推荐分类点击', attributes);
                    actionJump(tag.action);
                },
                showEssay: function (essay_id) {
                    var url = URL.openEssayWeb + '?essay_id=' + essay_id;
                    openWin('../home/browser', {url: url});
                },
                gettime:function(stamp){
                    var date = new Date(stamp*1000);
                    M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                    D = date.getDate() + ' ';
                    return M+D;
                }
            },
        })
    }
    //打开UIScrollPicture
    function fnOpen() {
        var paths = [];
        for (var i = 0, l = banners.length; i < l; i++) {
            paths.push(banners[i].image);
        }
        UIScrollPicture.open({
            rect: {
                x: 0,
                y: 0,
                w: api.frameWidth,
                h: 170
            },
            data: {
                paths: paths,
            },
            styles: {
                indicator: {
                    dot: {
                        w: 6,
                        h: 6,
                        r: 6,
                        margin: 6
                    },
                    align: 'center',
                    color: '#FFFFFF',
                    activeColor: '#DA70D6'
                }
            },
            contentMode: 'scaleToFill',
            interval: 3,
            loop: true,
            fixedOn: 'home',
            fixed: false
        }, function (ret) {
            if (ret.eventType == 'click') {
                onEvent('推荐广告点击');
                var banner = banners[ret.index];
                actionJump(banner.action);
            }
        });
    }


    function swiper() {
        var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        direction: 'vertical'
    });
    }
</script>

</html>